import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;

import java.io.IOException;

public class Demo1 {
    public static void main(String[] args) throws IOException {
        //获取工作簿
        XSSFWorkbook sheets=new XSSFWorkbook("H:\\test1.xlsx");
        //获取工作表
        XSSFSheet sheet1 = sheets.getSheetAt(0);
        for (Row row:sheet1
             ) {
            for (Cell cell:row
                 ) {
                String v=cell.getStringCellValue();
                System.out.println(v);
            }
        }
        if (sheets != null) {
            sheets.close();
        }
    }
}
